package com.wxb.annotationlog.controller;

import com.wxb.annotationlog.service.TestAnnotationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description 测试注解日志
 * @Author Major
 * @Date 2020/6/1 13:00
 */
@RestController
@RequestMapping(value = "/annotation/")
public class TestAnnotation {

    @Autowired
    private TestAnnotationService testAnnotationService;

    /**
     * @Description 测试正常日志
     * @Author Major
     * @Date 2020/6/3 15:41
     * @Param name: 参数
     * @return: java.lang.String
     */
    @GetMapping(value = "testNormal")
    public String testNormalAnnotaion(String name) throws Exception{
        Map<String,String> map = new HashMap<>();
        map.put("name",name);
        return testAnnotationService.testNormal(map);
    }

    /**
     * @Description 测试异常日志
     * @Author Major
     * @Date 2020/6/3 15:40
     * @Param name: 参数
     * @return: java.lang.String
     */
    @GetMapping(value = "testException")
    public String testExceptionAnnotaion(String name) throws Exception{
        Map<String,String> map = new HashMap<>();
        map.put("name",name);
        return testAnnotationService.testException(map);
    }

    /**
     * @Description 查询缓存日志
     * @Author Major
     * @Date 2020/6/3 15:40
     * @return: void
     */
    @GetMapping(value = "queryCacheLog")
    public String queryCacheLog(){
        testAnnotationService.queryCacheLog();
        return "SUCCESS";
    }
}
